<!-- $Id: topic_edit.htm 16992 2010-01-19 08:45:49Z wangleisvn $ -->

{include file="pageheader.htm"}
{insert_scripts files="../js/utils.js,selectzone.js,colorselector_topic.js"}
<script type="text/javascript" charset="utf-8" src="../includes/ueditor/ueditor.config.js"></script>
<script type="text/javascript" charset="utf-8" src="../includes/ueditor/ueditor.all.min.js"> </script>
<script type="text/javascript" charset="utf-8" src="../includes/ueditor/lang/zh-cn/zh-cn.js"></script>
{if $warning}
<ul style="padding:0; margin: 0; list-style-type:none; color: #CC0000;">
  <li style="border: 1px solid #CC0000; background: #FFFFCC; padding: 10px; margin-bottom: 5px;" >{$warning}</li>
</ul>
{/if}
<!-- start goods form -->
<div class="tab-div">
  <!-- tab bar -->
  <div id="tabbar-div">
    <p>
    	<span class="tab-front" id="general-tab">通用信息</span>
    	<span class="tab-back" id="detail-tab">详情</span>
    	<span class="tab-back" id="goods-tab">绑定套餐</span>
	</p>
  </div>
  <!-- tab body -->
  <div id="tabbody-div">
    <form enctype="multipart/form-data" action="category.php" method="post" name="theForm" autocomplete="off">
      <table cellspacing="1"  id="general-table" cellpadding="3" width="100%">
        <tr>
          <td class="label">病症名称</td>
          <td><input name="name" type="text" value="{$info.name}" size="40" />{$lang.require_field}</td>
        </tr>
        <tr>
          <td class="label">商品分类</td>
          <td>
          	<select name="cat_id">{$cat_list}</select>{$lang.require_field}
          </td>
        </tr>
        <tr>
          <td class="label">简述</td>
          <td><textarea name="description" id="description" cols="40" rows="5">{$info.description}</textarea></td>
        </tr>
        <tr>
	        <td class="label">上传图片</td>
	        <td>
	          <input type="file" name="img" size="35" />
	          {if $info.img}
	            <a href="goods.php?act=show_image&img_url={$info.img}" title="点击查看图片" target="_blank"><img src="images/yes.gif" border="0" /></a>
	          {else}
	            <img src="images/no.gif" />
	          {/if}
	          <span class="notice-span" style="display:block">200px * 100px</span>
	          <!-- <br /><input type="text" size="40" value="图片外部URL" style="color:#aaa;" onfocus="if (this.value == '图片外部URL'){this.value='http://';this.style.color='#000';}" name="img_url"/> -->
	        </td>
	      </tr>
      </table>
      <table width="90%" id="detail-table" style="display:none">
          <tr>
            <td>
               
			    <textarea id="detail" name="detail" style="width:100%;height:300px;"> {$info.detail}</textarea>
			    <script type="text/javascript">
			    delete(Object.prototype.toJSONString);
			    UE.getEditor('detail')
			
			    </script>
			</td>
          </tr>
        </table>
      <table width="90%" border="0"  align="center" cellpadding="0" cellspacing="0" id="goods-table" style="display:none;" >
      	<tr>
             <td class="label">套餐名</td>
             <td>
               <select id="goods_group" name="group_id" onchange="getGoodsList()" autocomplete="off">
                 {$group_list_html}
               </select>
             </td>
         </tr>
         <tr>
           <td id="tbody-goods" colspan="2" style="padding:0">{$goods_list_html}</td>
         </tr>
      </table>
      <div class="button-div">
        <input  name="goods_id" type="hidden" id="goods_id" value="{$info.goods_id}" />
        <input  name="act" type="hidden" value="{$form_act}" />
        <input  name="id" type="hidden" id="id" value="{$info.promote_id}" />
        <input type="submit" name="Submit" value="{$lang.button_submit}" class="button" onclick="return checkForm()"/>
        <input type="reset" name="Reset" value="{$lang.button_reset}" class="button"/>
      </div>
    </form>
  </div>
</div>
{insert_scripts files="validator.js,tab.js"}
<script type="Text/Javascript" language="JavaScript">

{literal}



onload = function()
{
  
  // 开始检查订单
  startCheckOrder();
  
}


function checkForm()
{
  var validator = new Validator('theForm');
  validator.required('name', '病症名称不能为空');
  validator.required('cat_id', '请选择商品分类');

  return validator.passed();
}

function getGoodsList()
{
    var selItem = document.forms['theForm'].elements['group_id'];
    
    if ( selItem != undefined)
    {
        var groupId = selItem.options[selItem.selectedIndex].value;
        var goodsId = selItem.options[selItem.selectedIndex].id;
        document.forms['theForm'].elements['goods_id'].value = goodsId;

        Ajax.call('category.php?act=promote_get_goods_list',
        		"group_id=" + groupId + "&goods_id=" +goodsId, setGoodsList, "GET", "JSON");
    }
}

function setGoodsList(result, text_result)
{
  document.getElementById('tbody-goods').innerHTML = result.content;
}


/**
 * 判断当前浏览器类型
 */
function navigator_type()
{
  var type_name = '';

  if (navigator.userAgent.indexOf('MSIE') != -1)
  {
    type_name = 'IE'; // IE
  }
  else if(navigator.userAgent.indexOf('Firefox') != -1)
  {
    type_name = 'FF'; // FF
  }
  else if(navigator.userAgent.indexOf('Opera') != -1)
  {
    type_name = 'Opera'; // Opera
  }
  else if(navigator.userAgent.indexOf('Safari') != -1)
  {
    type_name = 'Safari'; // Safari
  }
  else if(navigator.userAgent.indexOf('Chrome') != -1)
  {
    type_name = 'Chrome'; // Chrome
  }

  return type_name;
}
{/literal}
</script>
{include file="pagefooter.htm"}
